from hyrobot.common import STEP, CHECK_POINT
from lib.webui_permission import *
import pyautogui
import pytest
import time
import json
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.by import By


class c73254b:
    name = '验证所有界面存在且可操作产品列表部分-c73254b'  # 测试用例名字

    # 初始化方法
    def setup(self):
        STEP(1, '登陆网站')
        driver = open_browser()
        productor_login(driver)

    # 清除方法
    def teardown(self):
        driver = get_global_webdriver()
        driver.quit()

    # 测试用例步骤
    def teststeps(self):
        # 获取webdriver对象 对应 已经登录好的浏览器
        driver = get_global_webdriver()
        # driver = webdriver.Firefox()

        STEP(2,"下载模板")
        download_module(driver)
        download_mod_list = check_file()
        CHECK_POINT("下载模板，检测下载文件名与数量", download_mod_list[1].endswith(".csv") and download_mod_list[0] == 1)

        STEP(3,"查看详情")
        got_first_word = check_detail(driver)
        expected_first_word = "版本："
        CHECK_POINT("提示信息是否一致", got_first_word == expected_first_word)

        STEP(4,"页面跳转")
        turn_page(driver)

        STEP(2,"申请试用")
        commit_apply(driver)
